<template>
  <div id="content">
    <div id="header">
       <div class="header-title">
         <img src="../assets/图标.png" alt="网站logo" class="logo">
         <p>西安智慧文旅</p>
       </div>
       <ul class="header-ul">
        <li>首页</li>
        <li>联系我们</li>
        <li>加入收藏</li>
       </ul>
    </div>
    <div id="center">
        <div class="login-container">
          <register v-if="show" @isShow ="handleShow"/>
          <Login v-else @isShow ="handleShow"/>
        </div>
    </div>
    <div id="footer"></div>
  </div>
</template>

<script setup>

import Login from '@/components/login.vue'
import register from '@/components/register.vue'
import { ref } from 'vue'
const show = ref(false)
const username = ref("")
const password = ref("")
const handleShow= (data)=>{
  show.value = data.message
}
</script>

<style scoped>
/* 基础布局样式 */
#content {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* 防止水平滚动 */
}

/* 头部样式 */
#header {
  flex: 0 0 80px; /* 固定高度 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5%;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title p {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  margin: 0;
}

.header-ul {
  list-style: none;
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 0;
}

.header-ul li {
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  transition: color 0.3s;
}

.header-ul li:hover {
  color: #1890ff;
}

/* 中间内容区域 */
#center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url("../assets/背景图.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

/* 底部样式 */
#footer {
  flex: 0 0 60px;
  background-color: #f0f2f5;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #888;
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  #header {
    flex-direction: column;
    padding: 10px;
    height: auto;
  }
  
  .header-title {
    margin: 10px 0;
  }
  
  .header-ul {
    width: 100%;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 10px;
  }
  
  .logo {
    width: 40px;
  }
  
  .header-title p {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .header-ul {
    font-size: 0.9rem;
    gap: 10px;
  }
  
  .login-container {
    padding: 10px;
  }
}
</style>